#include <cstdio>
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
typedef struct Stu{
	int Id;
	int Class;
	string Name;
	double s1;
	double s2;
	double s3;
	double s;
}Stu;
void Sort(Stu a[],int n);
void Print(Stu a[],int n);
int main()
{
	Stu student[7]={
		{10001,11,"Zhang", 99.5, 88.5 ,89.5},
		{10002,12 ,"Yang", 77.9, 56.5, 87.5},
		{10003,11,"Liang", 92.5, 99.0, 60.5},
		{10004,11,"Cai", 93.6,67.9,90.5},
		{10005,14,"Fu", 55.6, 67.9, 98.9},
		{10006,12,"Mao", 22.1,45.9,99.2},
		{10007,13,"Zhan", 35.6 ,67.9 ,88.0}
	};
	for(int i=0;i<7;i++){
		student[i].s=student[i].s1+student[i].s2+student[i].s3;
	}
	Sort(student,7);
	Print(student,7);
	return 0;
}
void Sort(Stu a[],int n)
{
	for(int i=0;i<n-1;i++){
		for(int j=0;j<n-1-i;j++){
			if(a[j].Class>=a[j+1].Class){
				Stu temp=a[j];
				a[j]=a[j+1];
				a[j+1]=temp;
				if(a[j].Class==a[j+1].Class&&a[j].s<=a[j+1].s){
					Stu temp=a[j];
					a[j]=a[j+1];
					a[j+1]=temp;
					if(a[j].s==a[j+1].s&&a[j].s1<=a[j+1].s1){
						Stu temp=a[j];
						a[j]=a[j+1];
						a[j+1]=temp;
					}
				}
			}
		}
	}
}
void Print(Stu a[],int n)
{
	for(int i=0;i<n;i++){
		cout<<a[i].Id<<' '
			<<a[i].Class<<' '
			<<a[i].Name<<' '
			<<setiosflags(ios::fixed)<<setprecision(1)
			<<a[i].s1<<' '
			<<setiosflags(ios::fixed)<<setprecision(1)
			<<a[i].s2<<' '
			<<setiosflags(ios::fixed)<<setprecision(1)
			<<a[i].s3<<' '
			<<setiosflags(ios::fixed)<<setprecision(1)
			<<a[i].s<<endl;
	}
}
